<!DOCTYPE HTML>
<html>
<head>
    <include file="Common:header_include"/>
    <title>添加医院</title>
</head>
<body>
<div class="pd-20">
    <form action="{:U('add')}" method="post" class="form form-horizontal" id="form">
        <div class="row cl">
            <label class="form-label col-1"><span class="c-red">*</span>医院名：</label>
            <div class="formControls col-10">
                <input type="text" class="input-text" placeholder="请输入" name="name" datatype="*" nullmsg="不能为空">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-1"><span class="c-red"></span>&nbsp;图片:&nbsp;&nbsp;&nbsp;</label>
            <div class="formControls col-10">
                <input type="file" class="input-text" name="coverFile" accept="image/*">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-1"><span class="c-red">*</span>省区：</label>
            <div class="formControls col-10">
                <span class="select-box">
                <select class="select Validform_error" size="1" name="provinceid" datatype="*" onchange="onchangeProvince($(this))" nullmsg="请选择" id="provinceid">
                    <option value="" selected="" disabled="disabled">请选择</option>
                    <volist name=":getaerainfoList()" id="v">
                           <option value="{$v['aerainfo_id']}">{$v['aerainfo_name']}</option>
                    </volist>
                </select>
                </span>
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-1"><span class="c-red">*</span>市区：</label>
            <div class="formControls col-10">
                <span class="select-box">
                <select class="select Validform_error" size="1" name="cityid" datatype="*" nullmsg="请选择"  onchange="onchangecity($(this))" id="city">
                    <option value="" selected="" disabled="disabled">请选择</option>
                </select>
                </span>
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-1"><span class="c-red">*</span>区域：</label>
            <div class="formControls col-10">
                <span class="select-box">
                <select class="select Validform_error" size="1" name="regionid" datatype="*" nullmsg="请选择"  id="district">
                    <option value="" selected="" disabled="disabled">请选择</option>
                </select>
                </span>
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-1"><span class="c-red"></span>&nbsp;地址:&nbsp;&nbsp;&nbsp;</label>
            <div class="formControls col-10">
                <input type="text" class="input-text" name="addr" >
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-1"><span class="c-red"></span>&nbsp;联系电话:&nbsp;&nbsp;&nbsp;</label>
            <div class="formControls col-10">
                <input type="text" class="input-text" name="officephone" >
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-1"><span class="c-red"></span>&nbsp;联系人:&nbsp;&nbsp;&nbsp;</label>
            <div class="formControls col-10">
                <input type="text" class="input-text" name="linkman" >
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-1"><span class="c-red">*</span>描述：</label>
            <div class="formControls col-10">
                <script id="content" name="description" type="text/plain" style="width:100%;height:400px;"></script>
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <div class="col-9 col-offset-3">
                <input class="btn btn-primary radius" type="submit" value="提交">
            </div>
        </div>
    </form>
</div>
<include file="Common:footer_include"/>

</body>
<script type="text/javascript">
    $(function () {
        var ue = UE.getEditor('content');
    });
    function onchangeProvince(jqObj){
        var province_id = jqObj.val();
        var citycheck = $('#city');
        citycheck.html('');
        $.ajax({
            url: '{:U("Hospitalinfo/getCityListJson")}?province_id=' + province_id,
            type: 'post',
            enctype: 'multipart/form-data',
            success: function (data) {
                $.each(data, function (i, item) {
                    citycheck.append('<option value="' + item.aerainfo_id + '" >' + item.aerainfo_name + '</option>');
//                    var diseaseHtml="<div class='skin-minimal check-box' style='width: 200px;margin-top: 5px'> <div class='check-box'> <input type='checkbox' name='disease_id[]' checked value='"+item.id+"'>"+item.title+"</div> </div>";
//                    diseaseBox.append(diseaseHtml);
                });
                onchangecity(citycheck);
            },
        });

    }
    function onchangecity(jqObj){
        var city_id = jqObj.val();
        var districtcheck = $('#district');
        var ajaxurl='{:U("Hospitalinfo/getDistrictJson")}?city_id=' + city_id;
        districtcheck.html('');
        $.ajax({
            url:ajaxurl ,
            type: 'post',
            enctype: 'multipart/form-data',
            success: function (data) {
                $.each(data, function (i, items) {
                    districtcheck.append('<option value="'+ items.aerainfo_id + '" >'+ items.aerainfo_name + '</option>');
                });
            }
        });
    }
</script>
</html>